package de.schlinke_marius.database;

import android.database.Cursor;
import android.database.sqlite.SQLiteException;

public interface AnswersTbl {

	public static final String TABLE_NAME = "ANSWERS";
	
	public static final String COLUMN_ID = "_ID";
	
	public static final String COLUMN_FK_QUESTIONS = "FK_QUESTIONS";
	
	public static final String COLUMN_ANSWER = "ANSWER";
	
	public static final String[] COLUMNS = { COLUMN_ID, COLUMN_FK_QUESTIONS, COLUMN_ANSWER};
	
	public static final String CREATE_TABLE_ANSWERS = " CREATE TABLE  IF NOT EXISTS "
			+ TABLE_NAME
			+ " ( "
			+ COLUMN_ID + " INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL,"
			+ COLUMN_FK_QUESTIONS + " INTEGER, "
			+ COLUMN_ANSWER + " text, FOREIGN KEY (FK_QUESTIONS) REFERENCES QUESTIONS (_ID));";

	public static final String INSERT_INTO_ANSWERS = "INSERT INTO " + TABLE_NAME + " ( " + COLUMN_ID + "," + COLUMN_FK_QUESTIONS + "," + COLUMN_ANSWER + ") values (?,?,?)";

	public long insertIntoAnswers(int id,  int fkQuestion, String answer) throws SQLiteException;
	
	public Cursor getAnswers(int id) throws SQLiteException;
}
